# 防盗链 - 抓取梨视频

import requests


if __name__ == '__main__':
    # 1. 拿到 contId
    # url = 'https://assets.projects.newsday.com/animation-service/v1/1703266725/animation.mp4'     # 视频爬取
    url = 'https://a57.foxnews.com/prod-hp.foxnews.com/images/2023/12/343/193/d3a764e4a15c52c29a6a482571b0066c.gif'     # gif 爬取

    # 2. 拿到 videoStatus 返回的 json -> srcURL
    heads = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36'
    }

    resp = requests.get(url, headers=heads)
    resp.close()

    # 3. 下载视频
    # with open(f'./爬取文件/aaa.mp4', mode='wb') as file:
    with open(f'../../1. 爬虫基础入门练手/爬取文件/robot.gif', mode='wb') as file:
        file.write(resp.content)
        file.close()











